package com.demo.chapter8.patter.stratery;

public class Test {

	public static void main(String[] args) {
		Validator mumercValidator = new Validator(new IsNumber());
		Validator lowerCaseValidator = new Validator(new IsAllLowerCase());
		mumercValidator.validate("aaa");
		lowerCaseValidator.validate("bbb");
		
		//可以直接用lambda表达式取代具体实现类
		Validator mumercValidator2 = new Validator((String s) -> s.matches("\\d+"));
		Validator lowerCaseValidator2 = new Validator((String s) -> s.matches("[a-z]+"));
	}
	
}
